<?php

require_once 'config.inc';
require_once('_db.inc');
require_once('_ui.inc');
require_once '_common.inc';
require_once '_customer.inc';
// Create a database connection
$conn = db_connect(CUSTOMER_DB_USER, CUSTOMER_DB_PASSWORD);

 ui_print_header('Customer - Unblind N-1 Money Orders');

 $moneyOrders = db_do_query($conn,'SELECT * FROM mo_detail_customer where BATCH=' .$_POST['batch']. ' and mo_n<>' .$_POST['chosen']);
 
 //print_r($moneyOrders);
 echo <<<END
	<p>Unblinding N-1 Money Orders:</p>
	<form name="form1" method="post" action="2R_4_BankVerifyUnblindMO.php">
	<table width="500" border="0" cellspacing="1" cellpadding="3" align=center>
END;
foreach ($moneyOrders as $MO){
	//unblind money order
	echo "<input type='hidden' name='R[" .$MO[MO_N] ."]' value='". $MO[R] ."'>";
	// form MO string
	$unblinded_MO['id_hash']= form_id_strings($MO['UNIQUENESS_STRING'], $conn);
	$unblinded_MO['uniquestring'] = $MO['UNIQUENESS_STRING'];
	$unblinded_MO['amount'] = $MO['VAL'];
	//print_r($unblinded_MO);
	
	//print_r($unblinded_MO);
	$MOstr = mo_obj_to_string($unblinded_MO);

	echo "<tr><td>$MO[MO_N].<input type='text' size='50' name='MOstr[" .$MO[MO_N] ."]' value='". $MOstr ."'>";
	echo "<input type='hidden' name='R[" .$MO[MO_N] ."]' value='". $MO[R] ."'></td></tr>";
}
	//pass chosen money order
	echo "<input type='hidden' name='batch' value='". $_POST['batch'] ."'>";
echo "<input type='hidden' name='chosen' value='". $_POST['chosen'] ."'>";
echo <<<END
			<tr>
			<td><input type="submit" name="unblind" value="Unblind"></td>
			</tr>
			</table>
			</form>
END;
ui_print_footer(date('Y-m-d H:i:s'));
oci_close($conn);
?>